#include "settingsdialog.h"
#include "ui_settingsdialog.h"
#include <QSettings>

SettingsDialog::SettingsDialog(const QString & authorName, const QString & appName, QWidget *parent):
    QDialog(parent),
    ui(new Ui::SettingsDialog),
    m_authorName(authorName),
    m_appName(appName)

{
    ui->setupUi(this);
    QSettings settings(m_authorName, m_appName);
    ui->apiKeyLineEdit->setText( settings.value("apiKey").toString());
}

SettingsDialog::~SettingsDialog()
{
    delete ui;
}

void SettingsDialog::
accept()
{
    QSettings settings(m_authorName, m_appName);
    settings.setValue("apiKey", ui->apiKeyLineEdit->text());
    QDialog::accept();
}
